/*
* meta中属性的作用:
* permitName：当前路由对应的权限模块名，用于和后端返回的权限列表一一对应 *
* keepAlive {Boolean}: 当前路由是否为keepAlive模式
* query：当前路由默认的 query
* title：当前页面不需要侧边栏时顶部栏的标题。类型为 String/Function
* backUrlName：点击返回的时候，目标路由的name
* backQuery：点击返回的时候，目标路由的query
* backFn：点击返回的时候，执行的回调，参数是当前vue实例
* */

  
//所有需要权限的路由信息
  const permissionRouter = [ 
    {
      path: '/',
      name: 'home',
      component: () => import('@/views/MyHome'),
      meta: {
        requiresAuth: true, //这个字段表示,这个路由及子路由都需要登录后才能访问,如果没有token就会被重定向到login页面
      },
      children: [
        {
        path: 'dashboard',
        name: 'Dashboard',
        meta: {
           title: '仪表盘', 
           icon: 'dashboard', 
           roles: ['admin', 'user'], 
           permitName: 'dashboard' //这个字段用于匹配后端的权限列表,如果再后端返回的权限中,就会加入到动态路由中
          },
        component: () => import('@/views/page/Dashboard.vue'),
      },
      {
        path: 'userManage',
        name: 'Usermanage',
        meta: { title: '用户管理',
           icon: 'user', 
           roles: ['admin'],
           permitName: 'userManage'
          },
        component: () => import('@/views/page/usermanage.vue'),
      },
      {
        path: 'userdetail',
        name: 'userdetail',
        meta: { title: '用户详情',
           icon: 'userdetail', 
           roles: ['admin'],
           permitName: 'userdetail'
          },
        component: () => import('@/views/page/userdetail.vue'),
      },
      {
        path: 'about1',
        name: 'About1',
        meta: { title: '关于我们1', icon: 'info', roles: ['admin', 'user'] ,permitName: 'about1'},
        component: () => import('@/views/page/about1.vue'),
      },
      {
        path: 'about2',
        name: 'About2',
        meta: { title: '关于我们2', icon: 'info', roles: ['admin', 'user'] ,permitName: 'about2'},
        component: () => import('@/views/page/about2.vue'),
      }
      ],
    },
  ];
  

  

  
  
  export default permissionRouter;
  